﻿using SketchUpAPI.NET.Objects;
using SketchUpAPI.NET.SketchUp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SketchUpConsole.Examples
{
    public static class CreateGroup
    {
        public static void Run()
        {
            string writePath = @"ExampleFiles\1.skp";
            string read2022 = @"ExampleFiles\2022.skp";
            string read2 = @"ExampleFiles\2.skp";

            SketchUpApplication.Initialize();
            SketchUpModel skp = SketchUpModel.Create();
            Group gr = new Group();
            gr.Name = "groupTest";
            skp.Entities.Add(gr);

            GeometryInput geometry = new GeometryInput();
            Point3D[] points = new Point3D[]
            {
                new Point3D(0, 0, 0),
                new Point3D(100.0.ToModel(), 0, 0),
                new Point3D(100.0.ToModel(), 100.0.ToModel(), 0),
            };
            geometry.AddFace(points);

            gr.Entities.Add(geometry, true);

            skp.Save(writePath);
            skp.Dispose();
            SketchUpApplication.Terminate();
        }
    }
}